"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.http import HttpResponse


#注册  转换器 ,告知系统
from django.urls import register_converter
from apps.users.converters import UsernameConverter
#参数1： 转换器类   参数2：转换器别名
register_converter(UsernameConverter,'UC')


# 1. 导入系统的日志
import logging
# 2. 根据配置信息,创建日志器
logger=logging.getLogger('django')
    # 3. 记录日志
def log(request):
    # 3.1 如果有警告
    logger.warning('这里有一个警告')
    # 3.2 如果有错误
    logger.error('error')
    # 3.3 如果记录信息
    logger.info('123')

    return HttpResponse('log')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('log/',log),
    #导入子应用url
    path('',include('apps.users.urls')),
    #导入图片验证码url
    path('',include('apps.verifitions.urls')),
    # qq登陆的url
    path('',include('apps.oauth.urls')),
    #收货地址的url
    path('',include('apps.areas.urls')),
    #商品列表
    path('',include('apps.goods.urls')),
    #购物车
    path('',include('apps.carts.urls')),
    #订单结算
    path('',include('apps.order.urls')),
    #阿里支付
    path('',include('apps.payment.urls')),
]
